get_mode <- function(x) {
  tab <- table(x)
  mode <- names(tab)[which.max(tab)][1]
  mode <- ifelse(is.numeric(x), as.numeric(mode), mode)
  return(mode)
}